package com.erp.myAdapter

import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import com.erp.bean.XiSuZhiXiangBean
import com.erp.R
import com.erp.util.Myutil
import kotlinx.android.synthetic.main.lv_xisu_wuliao_item.view.*

/**
 * Created by Administrator on 2018/9/21/021.
 * 作者：刘洋
 */
class XisuWuliaoAdapter (val context : Context,var materials: MutableList<XiSuZhiXiangBean.material>)  : BaseAdapter(){
    var minflater: LayoutInflater = LayoutInflater.from(context)
    @SuppressLint("ViewHolder", "InflateParams")
    override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
        var v : View=minflater.inflate(R.layout.lv_xisu_wuliao_item,null)
        val bean=materials[position]
        Myutil.settv(bean.name,v.tv_m_name)
        Myutil.settv(bean.size,v.tv_m_size)
        Myutil.settv(bean.counts,v.tv_m_counts)
        return v
    }

    override fun getItem(position: Int): Any {
        return materials[position]
    }

    override fun getItemId(position: Int): Long {
        return position.toLong()
    }

    override fun getCount(): Int {
        return materials.size
    }
}